package com.chentf.data.datastructure.arrays;

/**
 * @author chentengfei
 * @desc 100以内的加法
 * @date 2022-01-03 18:00:44
 */
public class AddOneToHandred {
    /***
     * 100以内的加法
     */
    public static void main(String[] args) {
        int total = 0;
        int end = 100;
        //方式一:循环计算
        for (int i = 0;i <= end;i++){
            total += i;
        }
        //方式二:
        total = (1 + end) /2;
        System.out.println(total);
    }
}
